/**
 * unPlarer-Youtube 0.8.0 
 *
 * @author Alvaro Lopez, Juan Baquero
 * 
 * http://code.google.com/p/unplayer-youtube/
 **/

package unplayer.youtubeplayer.util;

import java.awt.Toolkit;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;

public class Tools {
	
	public static String getClipBoard()
	{
		String clip = "";
		Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
		Transferable t = cb.getContents(null);

//		DataFlavor dataFlavorStringJava;
		try {
//			dataFlavorStringJava = new DataFlavor("application/x-java-serialized-object; class=java.lang.String");
//
//			if (t.isDataFlavorSupported(dataFlavorStringJava)) {
//			   clip = (String) t.getTransferData(dataFlavorStringJava);
//			   System.out.println(clip);
//			}
			
			if(t.isDataFlavorSupported(DataFlavor.stringFlavor))
			{
				clip = (String)t.getTransferData(DataFlavor.stringFlavor);
			}
			
		} catch (UnsupportedFlavorException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		return clip;
	}

}
